%%%-------------------------------------------------------------------
%%% File:      erlymate_help.erl
%%% @author    Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
%%% @copyright 2007 Roberto Saccon
%%% @doc  
%%% Lookup of link to edoc
%%% @end  
%%%
%%% The MIT License
%%%
%%% Copyright (c) 2007 Roberto Saccon
%%%
%%% Permission is hereby granted, free of charge, to any person obtaining a copy
%%% of this software and associated documentation files (the "Software"), to deal
%%% in the Software without restriction, including without limitation the rights
%%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%%% copies of the Software, and to permit persons to whom the Software is
%%% furnished to do so, subject to the following conditions:
%%%
%%% The above copyright notice and this permission notice shall be included in
%%% all copies or substantial portions of the Software.
%%%
%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%%% THE SOFTWARE.
%%%
%%% @since 2007-12-05 by Roberto Saccon
%%%-------------------------------------------------------------------
-module(erlymate_help).
-author('rsaccon@gmail.com').

%% API
-export([ok/0, run/3,  generate_lookup_src/1]).

-define(SEPERATORS, [$+, $-, $/, $*,$=, $|,$<, $>,$/, $*, $(, $[, ${, $\s]).

%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% @spec () -> ok.
%% @doc
%% used to check availability and status of this module 
%% @end 
%%--------------------------------------------------------------------
ok() -> ok.


%%--------------------------------------------------------------------
%% @spec  (socket(), string(), string(), string(), string()) -> {exit, integer()}
%% @doc
%% main function to execute compilation
%% @end 
%%--------------------------------------------------------------------
run(Socket, {"Erlang", _File, Line, Word, LineIndex, _LineNumber, _SelectedText}, DocRoot) -> 
    io:format("TRACE ~p:~p ~p~n",[?MODULE, ?LINE, todo_refac_scan_processing]),
    case signature(Word, string:tokens(Line, ":"), Line, list_to_integer(LineIndex), 0) of
        main_index ->           
            Url = lists:concat(["file://", filename:join([DocRoot, "doc", "index.html"])]), 
            open_url(Socket, Url),
            done;           
        {Module, Function} ->          
            {_, Beam, _} = code:get_object_code(list_to_atom(Module)),        
            {ok,{_,[{abstract_code,{_,Ac}}]}} = beam_lib:chunks(Beam,[abstract_code]),    
            lists:foldl(fun(X, Acc) ->
                    case Acc of
                        continue ->
                            case erl_syntax:type(X) of
                                function ->
                                    case erl_syntax_lib:analyze_function(X) of
                                        {Name, Arity} ->
                                            case string:tokens(atom_to_list(Name), ["_"]) of
                                                [Function | _]  ->
                                                    case lookup(Module) of
                                                        Path when is_list(Path) ->
                                                            Url = lists:concat(["file://", 
                                                                filename:join([DocRoot, Path]), 
                                                                "#", Function, "/", Arity]),
                                                            open_url(Socket, Url),
                                                            done;
                                                        _ ->
                                                            Acc
                                                    end;
                                                _ ->
                                                    Acc
                                            end;
                                        _ ->
                                            Acc
                                    end;
                                _ ->
                                    Acc
                            end;
                        _ ->
                            Acc
                    end
                end,
                continue, 
                erl_syntax:form_list_elements(erl_syntax:form_list(Ac)));
        _ ->
            void    
    end,
    {exit, 0};
    
run(_, _, _) ->
    {exit, 0}.
        
       
signature(Word, [Line], Line, _, _) ->
    case string:strip(Word) of
        [] ->
            main_index; 
        Other ->
            {"erlang", Word}
    end;  
signature(Word, [Left , Right | Tail], Line, Pos, PosMin) ->
    PosMinNext = PosMin + length(Left) + 1,       
    Signature = case lists:reverse(string:tokens(Left, ?SEPERATORS)) of
        [Word | _] ->
            case is_in_range(PosMinNext - length(Word) - 1, Pos, PosMinNext - 1) of
                true ->
                    case string:tokens(Right, [$(, $)]) of
                        [] -> 
                            not_found;
                        [Function | _] -> 
                            {Word, Function}
                    end;
                _ ->
                    not_found                                          
            end;        
        [Other | _] ->
            case string:tokens(Right, "(") of
                [Word | _] ->
                    case is_in_range(PosMinNext, Pos, PosMinNext + length(Word)) of
                        true ->
                            {Other, Word};
                        _ ->
                            not_found
                    end;                
                _ ->
                    not_found
            end
    end, 
    case Tail of 
        [] ->
            Signature;
        _ ->
            case Signature of
                not_found ->
                    signature(Word, [Right | Tail], Line,  Pos, PosMinNext);
                _ ->
                    Signature
            end
    end.
   
is_in_range(PosMin, Pos, PosMax)  when (Pos >= PosMin) and (Pos =< PosMax) -> 
    true;
is_in_range(_, _, _) ->
    false.
                                     
%%--------------------------------------------------------------------
%% @spec (string()) -> any()  
%% @doc
%% only used to create "manually" the lookup statements of this sourcefile
%% @end 
%%--------------------------------------------------------------------      
generate_lookup_src(DocRoot) ->
    filelib:fold_files(filename:join([DocRoot, "lib"]),
        "\.html$",
        true,
        fun(Path, _Acc) ->
            Name = filename:rootname(filename:basename(Path)),
            AfterDocRoot = length(filename:split(DocRoot)),
            RelPath = filename:join(lists:nthtail(AfterDocRoot, filename:split(Path))),
            pattern_matching_src(RelPath, Name, code:which(list_to_atom(Name)))
        end,
        []).      

%%====================================================================
%% Internal functions
%%====================================================================

pattern_matching_src(_, _, non_existing) ->   
    ignore;
pattern_matching_src(RelPath, Name, _) ->
    io:format("lookup(~p) -> ~p;~n",[Name, RelPath]).

    
    
open_url(Socket, Url) ->
    erlymate:fwrite(Socket, "<meta http-equiv='Refresh' content='0;URL=~s'>", [Url]).
            
    
lookup("xmerl_xsd") -> "lib/xmerl-1.1.6/doc/html/xmerl_xsd.html";
lookup("xmerl_xs") -> "lib/xmerl-1.1.6/doc/html/xmerl_xs.html";
lookup("xmerl_xpath") -> "lib/xmerl-1.1.6/doc/html/xmerl_xpath.html";
lookup("xmerl_scan") -> "lib/xmerl-1.1.6/doc/html/xmerl_scan.html";
lookup("xmerl_eventp") -> "lib/xmerl-1.1.6/doc/html/xmerl_eventp.html";
lookup("xmerl") -> "lib/xmerl-1.1.6/doc/html/xmerl.html";
lookup("webtool") -> "lib/webtool-0.8.3.2/doc/html/webtool.html";
lookup("tv") -> "lib/tv-2.1.4.1/doc/html/tv.html";
lookup("xref") -> "lib/tools-2.6/doc/html/xref.html";
lookup("tags") -> "lib/tools-2.6/doc/html/tags.html";
lookup("make") -> "lib/tools-2.6/doc/html/make.html";
lookup("instrument") -> "lib/tools-2.6/doc/html/instrument.html";
lookup("fprof") -> "lib/tools-2.6/doc/html/fprof.html";
lookup("eprof") -> "lib/tools-2.6/doc/html/eprof.html";
lookup("cprof") -> "lib/tools-2.6/doc/html/cprof.html";
lookup("cover") -> "lib/tools-2.6/doc/html/cover.html";
lookup("toolbar") -> "lib/toolbar-1.3.0.1/doc/html/toolbar.html";
lookup("prettypr") -> "lib/syntax_tools-1.5.3/doc/html/prettypr.html";
lookup("igor") -> "lib/syntax_tools-1.5.3/doc/html/igor.html";
lookup("erl_tidy") -> "lib/syntax_tools-1.5.3/doc/html/erl_tidy.html";
lookup("erl_syntax_lib") -> "lib/syntax_tools-1.5.3/doc/html/erl_syntax_lib.html";
lookup("erl_syntax") -> "lib/syntax_tools-1.5.3/doc/html/erl_syntax.html";
lookup("erl_recomment") -> "lib/syntax_tools-1.5.3/doc/html/erl_recomment.html";
lookup("erl_prettypr") -> "lib/syntax_tools-1.5.3/doc/html/erl_prettypr.html";
lookup("erl_comment_scan") -> "lib/syntax_tools-1.5.3/doc/html/erl_comment_scan.html";
lookup("epp_dodger") -> "lib/syntax_tools-1.5.3/doc/html/epp_dodger.html";
lookup("zip") -> "lib/stdlib-1.15/doc/html/zip.html";
lookup("win32reg") -> "lib/stdlib-1.15/doc/html/win32reg.html";
lookup("timer") -> "lib/stdlib-1.15/doc/html/timer.html";
lookup("sys") -> "lib/stdlib-1.15/doc/html/sys.html";
lookup("supervisor_bridge") -> "lib/stdlib-1.15/doc/html/supervisor_bridge.html";
lookup("supervisor") -> "lib/stdlib-1.15/doc/html/supervisor.html";
lookup("string") -> "lib/stdlib-1.15/doc/html/string.html";
lookup("sofs") -> "lib/stdlib-1.15/doc/html/sofs.html";
lookup("slave") -> "lib/stdlib-1.15/doc/html/slave.html";
lookup("shell_default") -> "lib/stdlib-1.15/doc/html/shell_default.html";
lookup("shell") -> "lib/stdlib-1.15/doc/html/shell.html";
lookup("sets") -> "lib/stdlib-1.15/doc/html/sets.html";
lookup("regexp") -> "lib/stdlib-1.15/doc/html/regexp.html";
lookup("random") -> "lib/stdlib-1.15/doc/html/random.html";
lookup("queue") -> "lib/stdlib-1.15/doc/html/queue.html";
lookup("qlc") -> "lib/stdlib-1.15/doc/html/qlc.html";
lookup("proplists") -> "lib/stdlib-1.15/doc/html/proplists.html";
lookup("proc_lib") -> "lib/stdlib-1.15/doc/html/proc_lib.html";
lookup("pool") -> "lib/stdlib-1.15/doc/html/pool.html";
lookup("pg") -> "lib/stdlib-1.15/doc/html/pg.html";
lookup("ordsets") -> "lib/stdlib-1.15/doc/html/ordsets.html";
lookup("orddict") -> "lib/stdlib-1.15/doc/html/orddict.html";
lookup("ms_transform") -> "lib/stdlib-1.15/doc/html/ms_transform.html";
lookup("math") -> "lib/stdlib-1.15/doc/html/math.html";
lookup("log_mf_h") -> "lib/stdlib-1.15/doc/html/log_mf_h.html";
lookup("lists") -> "lib/stdlib-1.15/doc/html/lists.html";
lookup("lib") -> "lib/stdlib-1.15/doc/html/lib.html";
lookup("io_lib") -> "lib/stdlib-1.15/doc/html/io_lib.html";
lookup("io") -> "lib/stdlib-1.15/doc/html/io.html";
lookup("gen_server") -> "lib/stdlib-1.15/doc/html/gen_server.html";
lookup("gen_fsm") -> "lib/stdlib-1.15/doc/html/gen_fsm.html";
lookup("gen_event") -> "lib/stdlib-1.15/doc/html/gen_event.html";
lookup("gb_trees") -> "lib/stdlib-1.15/doc/html/gb_trees.html";
lookup("gb_sets") -> "lib/stdlib-1.15/doc/html/gb_sets.html";
lookup("filename") -> "lib/stdlib-1.15/doc/html/filename.html";
lookup("filelib") -> "lib/stdlib-1.15/doc/html/filelib.html";
lookup("file_sorter") -> "lib/stdlib-1.15/doc/html/file_sorter.html";
lookup("ets") -> "lib/stdlib-1.15/doc/html/ets.html";
lookup("erl_tar") -> "lib/stdlib-1.15/doc/html/erl_tar.html";
lookup("erl_scan") -> "lib/stdlib-1.15/doc/html/erl_scan.html";
lookup("erl_pp") -> "lib/stdlib-1.15/doc/html/erl_pp.html";
lookup("erl_parse") -> "lib/stdlib-1.15/doc/html/erl_parse.html";
lookup("erl_lint") -> "lib/stdlib-1.15/doc/html/erl_lint.html";
lookup("erl_internal") -> "lib/stdlib-1.15/doc/html/erl_internal.html";
lookup("erl_expand_records") -> "lib/stdlib-1.15/doc/html/erl_expand_records.html";
lookup("erl_eval") -> "lib/stdlib-1.15/doc/html/erl_eval.html";
lookup("epp") -> "lib/stdlib-1.15/doc/html/epp.html";
lookup("digraph_utils") -> "lib/stdlib-1.15/doc/html/digraph_utils.html";
lookup("digraph") -> "lib/stdlib-1.15/doc/html/digraph.html";
lookup("dict") -> "lib/stdlib-1.15/doc/html/dict.html";
lookup("dets") -> "lib/stdlib-1.15/doc/html/dets.html";
lookup("calendar") -> "lib/stdlib-1.15/doc/html/calendar.html";
lookup("c") -> "lib/stdlib-1.15/doc/html/c.html";
lookup("beam_lib") -> "lib/stdlib-1.15/doc/html/beam_lib.html";
lookup("base64") -> "lib/stdlib-1.15/doc/html/base64.html";
lookup("ssl_pkix") -> "lib/ssl-3.9/doc/html/ssl_pkix.html";
lookup("ssl_app") -> "lib/ssl-3.9/doc/html/ssl_app.html";
lookup("ssl") -> "lib/ssl-3.9/doc/html/ssl.html";
lookup("ssh_transport") -> "lib/ssh-0.9.9.3/doc/html/ssh_transport.html";
lookup("ssh_sshd") -> "lib/ssh-0.9.9.3/doc/html/ssh_sshd.html";
lookup("ssh_ssh") -> "lib/ssh-0.9.9.3/doc/html/ssh_ssh.html";
lookup("ssh_sftpd") -> "lib/ssh-0.9.9.3/doc/html/ssh_sftpd.html";
lookup("ssh_sftp") -> "lib/ssh-0.9.9.3/doc/html/ssh_sftp.html";
lookup("ssh_cm") -> "lib/ssh-0.9.9.3/doc/html/ssh_cm.html";
lookup("ssh_cli") -> "lib/ssh-0.9.9.3/doc/html/ssh_cli.html";
lookup("ssh") -> "lib/ssh-0.9.9.3/doc/html/ssh.html";
lookup("snmpm_user") -> "lib/snmp-4.10/doc/html/snmpm_user.html";
lookup("snmpm_network_interface") -> "lib/snmp-4.10/doc/html/snmpm_network_interface.html";
lookup("snmpm_mpd") -> "lib/snmp-4.10/doc/html/snmpm_mpd.html";
lookup("snmpm_conf") -> "lib/snmp-4.10/doc/html/snmpm_conf.html";
lookup("snmpm") -> "lib/snmp-4.10/doc/html/snmpm.html";
lookup("snmpc") -> "lib/snmp-4.10/doc/html/snmpc.html";
lookup("snmpa_supervisor") -> "lib/snmp-4.10/doc/html/snmpa_supervisor.html";
lookup("snmpa_notification_filter") -> "lib/snmp-4.10/doc/html/snmpa_notification_filter.html";
lookup("snmpa_network_interface") -> "lib/snmp-4.10/doc/html/snmpa_network_interface.html";
lookup("snmpa_mpd") -> "lib/snmp-4.10/doc/html/snmpa_mpd.html";
lookup("snmpa_local_db") -> "lib/snmp-4.10/doc/html/snmpa_local_db.html";
lookup("snmpa_error_report") -> "lib/snmp-4.10/doc/html/snmpa_error_report.html";
lookup("snmpa_error_logger") -> "lib/snmp-4.10/doc/html/snmpa_error_logger.html";
lookup("snmpa_error_io") -> "lib/snmp-4.10/doc/html/snmpa_error_io.html";
lookup("snmpa_error") -> "lib/snmp-4.10/doc/html/snmpa_error.html";
lookup("snmpa_conf") -> "lib/snmp-4.10/doc/html/snmpa_conf.html";
lookup("snmpa") -> "lib/snmp-4.10/doc/html/snmpa.html";
lookup("snmp_view_based_acm_mib") -> "lib/snmp-4.10/doc/html/snmp_view_based_acm_mib.html";
lookup("snmp_user_based_sm_mib") -> "lib/snmp-4.10/doc/html/snmp_user_based_sm_mib.html";
lookup("snmp_target_mib") -> "lib/snmp-4.10/doc/html/snmp_target_mib.html";
lookup("snmp_standard_mib") -> "lib/snmp-4.10/doc/html/snmp_standard_mib.html";
lookup("snmp_pdus") -> "lib/snmp-4.10/doc/html/snmp_pdus.html";
lookup("snmp_notification_mib") -> "lib/snmp-4.10/doc/html/snmp_notification_mib.html";
lookup("snmp_index") -> "lib/snmp-4.10/doc/html/snmp_index.html";
lookup("snmp_generic") -> "lib/snmp-4.10/doc/html/snmp_generic.html";
lookup("snmp_framework_mib") -> "lib/snmp-4.10/doc/html/snmp_framework_mib.html";
lookup("snmp_config") -> "lib/snmp-4.10/doc/html/snmp_config.html";
lookup("snmp_community_mib") -> "lib/snmp-4.10/doc/html/snmp_community_mib.html";
lookup("snmp_app") -> "lib/snmp-4.10/doc/html/snmp_app.html";
lookup("snmp") -> "lib/snmp-4.10/doc/html/snmp.html";
lookup("systools") -> "lib/sasl-2.1.5.2/doc/html/systools.html";
lookup("release_handler") -> "lib/sasl-2.1.5.2/doc/html/release_handler.html";
lookup("rb") -> "lib/sasl-2.1.5.2/doc/html/rb.html";
lookup("overload") -> "lib/sasl-2.1.5.2/doc/html/overload.html";
lookup("alarm_handler") -> "lib/sasl-2.1.5.2/doc/html/alarm_handler.html";
lookup("erts_alloc_config") -> "lib/runtime_tools-1.7/doc/html/erts_alloc_config.html";
lookup("dbg") -> "lib/runtime_tools-1.7/doc/html/dbg.html";
lookup("pman") -> "lib/pman-2.6/doc/html/pman.html";
lookup("yecc") -> "lib/parsetools-1.4.2/doc/html/yecc.html";
lookup("otp_mib") -> "lib/otp_mibs-1.0.4.1/doc/html/otp_mib.html";
lookup("os_sup") -> "lib/os_mon-2.1.3/doc/html/os_sup.html";
lookup("os_mon_mib") -> "lib/os_mon-2.1.3/doc/html/os_mon_mib.html";
lookup("os_mon") -> "lib/os_mon-2.1.3/doc/html/os_mon.html";
lookup("nteventlog") -> "lib/os_mon-2.1.3/doc/html/nteventlog.html";
lookup("memsup") -> "lib/os_mon-2.1.3/doc/html/memsup.html";
lookup("disksup") -> "lib/os_mon-2.1.3/doc/html/disksup.html";
lookup("cpu_sup") -> "lib/os_mon-2.1.3/doc/html/cpu_sup.html";
lookup("orber_tc") -> "lib/orber-3.6.8/doc/html/orber_tc.html";
lookup("orber_ifr") -> "lib/orber-3.6.8/doc/html/orber_ifr.html";
lookup("orber_diagnostics") -> "lib/orber-3.6.8/doc/html/orber_diagnostics.html";
lookup("orber_acl") -> "lib/orber-3.6.8/doc/html/orber_acl.html";
lookup("orber") -> "lib/orber-3.6.8/doc/html/orber.html";
lookup("lname_component") -> "lib/orber-3.6.8/doc/html/lname_component.html";
lookup("lname") -> "lib/orber-3.6.8/doc/html/lname.html";
lookup("fixed") -> "lib/orber-3.6.8/doc/html/fixed.html";
lookup("CosNaming_NamingContextExt") -> "lib/orber-3.6.8/doc/html/CosNaming_NamingContextExt.html";
lookup("CosNaming_NamingContext") -> "lib/orber-3.6.8/doc/html/CosNaming_NamingContext.html";
lookup("CosNaming_BindingIterator") -> "lib/orber-3.6.8/doc/html/CosNaming_BindingIterator.html";
lookup("corba_object") -> "lib/orber-3.6.8/doc/html/corba_object.html";
lookup("corba") -> "lib/orber-3.6.8/doc/html/corba.html";
lookup("any") -> "lib/orber-3.6.8/doc/html/any.html";
lookup("odbc") -> "lib/odbc-2.0.9/doc/html/odbc.html";
lookup("ttb") -> "lib/observer-0.9.7.4/doc/html/ttb.html";
lookup("etop") -> "lib/observer-0.9.7.4/doc/html/etop.html";
lookup("mnesia_registry") -> "lib/mnesia-4.4/doc/html/mnesia_registry.html";
lookup("mnesia_frag_hash") -> "lib/mnesia-4.4/doc/html/mnesia_frag_hash.html";
lookup("mnesia") -> "lib/mnesia-4.4/doc/html/mnesia.html";
lookup("megaco_udp") -> "lib/megaco-3.7/doc/html/megaco_udp.html";
lookup("megaco_transport") -> "lib/megaco-3.7/doc/html/megaco_transport.html";
lookup("megaco_tcp") -> "lib/megaco-3.7/doc/html/megaco_tcp.html";
lookup("megaco_flex_scanner") -> "lib/megaco-3.7/doc/html/megaco_flex_scanner.html";
lookup("megaco_encoder") -> "lib/megaco-3.7/doc/html/megaco_encoder.html";
lookup("megaco_edist_compress") -> "lib/megaco-3.7/doc/html/megaco_edist_compress.html";
lookup("megaco") -> "lib/megaco-3.7/doc/html/megaco.html";
lookup("zlib") -> "lib/kernel-2.12/doc/html/zlib.html";
lookup("wrap_log_reader") -> "lib/kernel-2.12/doc/html/wrap_log_reader.html";
lookup("user") -> "lib/kernel-2.12/doc/html/user.html";
lookup("seq_trace") -> "lib/kernel-2.12/doc/html/seq_trace.html";
lookup("rpc") -> "lib/kernel-2.12/doc/html/rpc.html";
lookup("pg2") -> "lib/kernel-2.12/doc/html/pg2.html";
lookup("packages") -> "lib/kernel-2.12/doc/html/packages.html";
lookup("os") -> "lib/kernel-2.12/doc/html/os.html";
lookup("net_kernel") -> "lib/kernel-2.12/doc/html/net_kernel.html";
lookup("net_adm") -> "lib/kernel-2.12/doc/html/net_adm.html";
lookup("init") -> "lib/kernel-2.12/doc/html/init.html";
lookup("inet") -> "lib/kernel-2.12/doc/html/inet.html";
lookup("heart") -> "lib/kernel-2.12/doc/html/heart.html";
lookup("global_group") -> "lib/kernel-2.12/doc/html/global_group.html";
lookup("global") -> "lib/kernel-2.12/doc/html/global.html";
lookup("gen_udp") -> "lib/kernel-2.12/doc/html/gen_udp.html";
lookup("gen_tcp") -> "lib/kernel-2.12/doc/html/gen_tcp.html";
lookup("gen_sctp") -> "lib/kernel-2.12/doc/html/gen_sctp.html";
lookup("file") -> "lib/kernel-2.12/doc/html/file.html";
lookup("error_logger") -> "lib/kernel-2.12/doc/html/error_logger.html";
lookup("error_handler") -> "lib/kernel-2.12/doc/html/error_handler.html";
lookup("erlang") -> "lib/kernel-2.12/doc/html/erlang.html";
lookup("erl_prim_loader") -> "lib/kernel-2.12/doc/html/erl_prim_loader.html";
lookup("erl_ddll") -> "lib/kernel-2.12/doc/html/erl_ddll.html";
lookup("erl_boot_server") -> "lib/kernel-2.12/doc/html/erl_boot_server.html";
lookup("disk_log") -> "lib/kernel-2.12/doc/html/disk_log.html";
lookup("code") -> "lib/kernel-2.12/doc/html/code.html";
lookup("auth") -> "lib/kernel-2.12/doc/html/auth.html";
lookup("application") -> "lib/kernel-2.12/doc/html/application.html";
% lookup("packages") -> "lib/jinterface-1.4/doc/html/java/packages.html"; %% ?????
lookup("inviso_rt_meta") -> "lib/inviso-0.6/doc/html/inviso_rt_meta.html";
lookup("inviso_rt") -> "lib/inviso-0.6/doc/html/inviso_rt.html";
lookup("inviso_lfm_tpfreader") -> "lib/inviso-0.6/doc/html/inviso_lfm_tpfreader.html";
lookup("inviso_lfm") -> "lib/inviso-0.6/doc/html/inviso_lfm.html";
lookup("inviso_as_lib") -> "lib/inviso-0.6/doc/html/inviso_as_lib.html";
lookup("inviso") -> "lib/inviso-0.6/doc/html/inviso.html";
lookup("tftp") -> "lib/inets-5.0/doc/html/tftp.html";
lookup("mod_security") -> "lib/inets-5.0/doc/html/mod_security.html";
lookup("mod_esi") -> "lib/inets-5.0/doc/html/mod_esi.html";
lookup("mod_auth") -> "lib/inets-5.0/doc/html/mod_auth.html";
lookup("mod_alias") -> "lib/inets-5.0/doc/html/mod_alias.html";
lookup("inets") -> "lib/inets-5.0/doc/html/inets.html";
lookup("httpd_util") -> "lib/inets-5.0/doc/html/httpd_util.html";
lookup("httpd_socket") -> "lib/inets-5.0/doc/html/httpd_socket.html";
lookup("httpd_conf") -> "lib/inets-5.0/doc/html/httpd_conf.html";
lookup("httpd") -> "lib/inets-5.0/doc/html/httpd.html";
lookup("http") -> "lib/inets-5.0/doc/html/http.html";
lookup("ftp") -> "lib/inets-5.0/doc/html/ftp.html";
% lookup("packages") -> "lib/ic-4.2.16/doc/html/java/packages.html"; %% ?????
lookup("ic") -> "lib/ic-4.2.16/doc/html/ic.html";
lookup("gs") -> "lib/gs-1.5.7/doc/html/gs.html";
lookup("et_viewer") -> "lib/et-1.3/doc/html/et_viewer.html";
lookup("et_selector") -> "lib/et-1.3/doc/html/et_selector.html";
lookup("et_collector") -> "lib/et-1.3/doc/html/et_collector.html";
lookup("et") -> "lib/et-1.3/doc/html/et.html";
lookup("edoc_run") -> "lib/edoc-0.7.4/doc/html/edoc_run.html";
lookup("edoc_lib") -> "lib/edoc-0.7.4/doc/html/edoc_lib.html";
lookup("edoc_layout") -> "lib/edoc-0.7.4/doc/html/edoc_layout.html";
lookup("edoc_extract") -> "lib/edoc-0.7.4/doc/html/edoc_extract.html";
lookup("edoc_doclet") -> "lib/edoc-0.7.4/doc/html/edoc_doclet.html";
lookup("edoc") -> "lib/edoc-0.7.4/doc/html/edoc.html";
lookup("docb_xml_check") -> "lib/docbuilder-0.9.7/doc/html/docb_xml_check.html";
lookup("docb_transform") -> "lib/docbuilder-0.9.7/doc/html/docb_transform.html";
lookup("docb_gen") -> "lib/docbuilder-0.9.7/doc/html/docb_gen.html";
lookup("dialyzer") -> "lib/dialyzer-1.7.1/doc/html/dialyzer.html";
lookup("int") -> "lib/debugger-3.1.1.1/doc/html/int.html";
lookup("i") -> "lib/debugger-3.1.1.1/doc/html/i.html";
lookup("debugger") -> "lib/debugger-3.1.1.1/doc/html/debugger.html";
lookup("crypto_app") -> "lib/crypto-1.5.1.1/doc/html/crypto_app.html";
lookup("crypto") -> "lib/crypto-1.5.1.1/doc/html/crypto.html";
lookup("CosTransactions_TransactionFactory") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_TransactionFactory.html";
lookup("CosTransactions_Terminator") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_Terminator.html";
lookup("CosTransactions_SubtransactionAwareResource") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_SubtransactionAwareResource.html";
lookup("CosTransactions_Resource") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_Resource.html";
lookup("CosTransactions_RecoveryCoordinator") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_RecoveryCoordinator.html"; 
lookup("CosTransactions_Coordinator") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_Coordinator.html";
lookup("CosTransactions_Control") -> "lib/cosTransactions-1.2.3/doc/html/CosTransactions_Control.html";
lookup("cosTransactions") -> "lib/cosTransactions-1.2.3/doc/html/cosTransactions.html";
lookup("CosTimerEvent_TimerEventService") -> "lib/cosTime-1.1.2/doc/html/CosTimerEvent_TimerEventService.html";
lookup("CosTimerEvent_TimerEventHandler") -> "lib/cosTime-1.1.2/doc/html/CosTimerEvent_TimerEventHandler.html";
lookup("CosTime_UTO") -> "lib/cosTime-1.1.2/doc/html/CosTime_UTO.html";
lookup("CosTime_TIO") -> "lib/cosTime-1.1.2/doc/html/CosTime_TIO.html";
lookup("CosTime_TimeService") -> "lib/cosTime-1.1.2/doc/html/CosTime_TimeService.html";
lookup("cosTime") -> "lib/cosTime-1.1.2/doc/html/cosTime.html";
lookup("CosPropertyService_PropertySetFactory") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertySetFactory.html"; 
lookup("CosPropertyService_PropertySetDefFactory") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertySetDefFactory.html";
lookup("CosPropertyService_PropertySetDef") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertySetDef.html";
lookup("CosPropertyService_PropertySet") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertySet.html";
lookup("CosPropertyService_PropertyNamesIterator") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertyNamesIterator.html";
lookup("CosPropertyService_PropertiesIterator") -> "lib/cosProperty-1.1.5/doc/html/CosPropertyService_PropertiesIterator.html"; 
lookup("cosProperty") -> "lib/cosProperty-1.1.5/doc/html/cosProperty.html";
lookup("CosNotifyFilter_MappingFilter") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyFilter_MappingFilter.html";
lookup("CosNotifyFilter_FilterFactory") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyFilter_FilterFactory.html";
lookup("CosNotifyFilter_FilterAdmin") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyFilter_FilterAdmin.html";
lookup("CosNotifyFilter_Filter") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyFilter_Filter.html";
lookup("CosNotifyComm_NotifySubscribe") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyComm_NotifySubscribe.html";
lookup("CosNotifyComm_NotifyPublish") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyComm_NotifyPublish.html";
lookup("CosNotifyChannelAdmin_SupplierAdmin") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_SupplierAdmin.html"; 
lookup("CosNotifyChannelAdmin_StructuredProxyPushSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_StructuredProxyPushSupplier.html";
lookup("CosNotifyChannelAdmin_StructuredProxyPushConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_StructuredProxyPushConsumer.html";
lookup("CosNotifyChannelAdmin_StructuredProxyPullSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_StructuredProxyPullSupplier.html";
lookup("CosNotifyChannelAdmin_StructuredProxyPullConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_StructuredProxyPullConsumer.html";
lookup("CosNotifyChannelAdmin_SequenceProxyPushSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_SequenceProxyPushSupplier.html";
lookup("CosNotifyChannelAdmin_SequenceProxyPushConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_SequenceProxyPushConsumer.html";
lookup("CosNotifyChannelAdmin_SequenceProxyPullSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_SequenceProxyPullSupplier.html";
lookup("CosNotifyChannelAdmin_SequenceProxyPullConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_SequenceProxyPullConsumer.html";
lookup("CosNotifyChannelAdmin_ProxySupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxySupplier.html"; 
lookup("CosNotifyChannelAdmin_ProxyPushSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxyPushSupplier.html";
lookup("CosNotifyChannelAdmin_ProxyPushConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxyPushConsumer.html";
lookup("CosNotifyChannelAdmin_ProxyPullSupplier") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxyPullSupplier.html";
lookup("CosNotifyChannelAdmin_ProxyPullConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxyPullConsumer.html";
lookup("CosNotifyChannelAdmin_ProxyConsumer") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ProxyConsumer.html"; 
lookup("CosNotifyChannelAdmin_EventChannelFactory") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_EventChannelFactory.html";
lookup("CosNotifyChannelAdmin_EventChannel") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_EventChannel.html";
lookup("CosNotifyChannelAdmin_ConsumerAdmin") -> "lib/cosNotification-1.1.6/doc/html/CosNotifyChannelAdmin_ConsumerAdmin.html"; 
lookup("cosNotificationApp") -> "lib/cosNotification-1.1.6/doc/html/cosNotificationApp.html";
lookup("CosNotification_QoSAdmin") -> "lib/cosNotification-1.1.6/doc/html/CosNotification_QoSAdmin.html";
lookup("CosNotification_AdminPropertiesAdmin") -> "lib/cosNotification-1.1.6/doc/html/CosNotification_AdminPropertiesAdmin.html";
lookup("CosNotification") -> "lib/cosNotification-1.1.6/doc/html/CosNotification.html";
lookup("cosFileTransferApp") -> "lib/cosFileTransfer-1.1.4/doc/html/cosFileTransferApp.html";
lookup("CosFileTransfer_VirtualFileSystem") -> "lib/cosFileTransfer-1.1.4/doc/html/CosFileTransfer_VirtualFileSystem.html";
lookup("CosFileTransfer_FileTransferSession") -> "lib/cosFileTransfer-1.1.4/doc/html/CosFileTransfer_FileTransferSession.html"; 
lookup("CosFileTransfer_FileIterator") -> "lib/cosFileTransfer-1.1.4/doc/html/CosFileTransfer_FileIterator.html";
lookup("CosFileTransfer_File") -> "lib/cosFileTransfer-1.1.4/doc/html/CosFileTransfer_File.html";
lookup("CosFileTransfer_Directory") -> "lib/cosFileTransfer-1.1.4/doc/html/CosFileTransfer_Directory.html";
lookup("cosEventDomainApp") -> "lib/cosEventDomain-1.1.2/doc/html/cosEventDomainApp.html";
lookup("CosEventDomainAdmin_EventDomainFactory") -> "lib/cosEventDomain-1.1.2/doc/html/CosEventDomainAdmin_EventDomainFactory.html";
lookup("CosEventDomainAdmin_EventDomain") -> "lib/cosEventDomain-1.1.2/doc/html/CosEventDomainAdmin_EventDomain.html";
lookup("CosEventDomainAdmin") -> "lib/cosEventDomain-1.1.2/doc/html/CosEventDomainAdmin.html";
lookup("CosEventChannelAdmin_SupplierAdmin") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_SupplierAdmin.html";
lookup("CosEventChannelAdmin_ProxyPushSupplier") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_ProxyPushSupplier.html";
lookup("CosEventChannelAdmin_ProxyPushConsumer") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_ProxyPushConsumer.html";
lookup("CosEventChannelAdmin_ProxyPullSupplier") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_ProxyPullSupplier.html";
lookup("CosEventChannelAdmin_ProxyPullConsumer") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_ProxyPullConsumer.html";
lookup("CosEventChannelAdmin_EventChannel") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_EventChannel.html";
lookup("CosEventChannelAdmin_ConsumerAdmin") -> "lib/cosEvent-2.1.2/doc/html/CosEventChannelAdmin_ConsumerAdmin.html";
lookup("cosEventApp") -> "lib/cosEvent-2.1.2/doc/html/cosEventApp.html"; 
lookup("compile") -> "lib/compiler-4.5/doc/html/compile.html";
lookup("asn1rt") -> "lib/asn1-1.5/doc/html/asn1rt.html";
lookup("asn1ct") -> "lib/asn1-1.5/doc/html/asn1ct.html";
lookup("appmon") -> "lib/appmon-2.1.9/doc/html/appmon.html";
lookup(_) -> not_found.


